<?php

namespace App\Services;

class DoubanService {
	const APIKEY = '0df993c66c0c636e29ecbb5344252a4a';
	const URL = "https://api.douban.com/";

	/**
	 * 通过isbn查图书信息
	 * @Author   wangwenfan
	 * @DateTime 2019-12-04
	 * @param    string     $isbn
	 * @return   array
	 */
	public static function isbnBook($isbn) {
		$url = self::URL . 'v2/book/isbn/' . $isbn . '?apikey=' . self::APIKEY;
		$result = GraspService::exeCurl($url, self::URL);
		$json = json_decode($result, true);
		return is_null($json) ? [] : $json;
	}
}
